package com.android.cargoapp.cargoapp_gui_prototype;

import android.os.AsyncTask;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;

public class SplashScreen extends Activity {
	private boolean beenden = false;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		
		setContentView(R.layout.activity_splashscreen);
		
		new AsyncTask<String, String, String>() {
			
			@Override
			protected String doInBackground(String... params) {
				try {
					Thread.sleep(2000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				return "";
			}
			protected void onPostExecute(String result) {
				Intent i = new Intent();
				i.setClassName("com.android.cargoapp.cargoapp_gui_prototype", MainActivity.class.getName());
				startActivity(i);
			};
			
		}.execute("");
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// getMenuInflater().inflate(R.menu.activity_main, menu);
		return false;
	}
	
	@Override
	public boolean onMenuItemSelected(int featureId, MenuItem item) {		
		// return super.onMenuItemSelected(featureId, item);
		return false;
	}
	
	@Override
	protected void onResume() {
		if(beenden)
			finish();
		
		beenden = true;
		
		super.onResume();
	}
	
	@Override
	public void onBackPressed() {
		// super.onBackPressed();
	}
	
}
